package com.qiu.greened.adapter

import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.qiu.greened.R
import com.qiu.greened.bean.PostBean
import com.qiu.greened.network.ServiceCreator

class PostAdapter2 : BaseQuickAdapter<PostBean, BaseViewHolder>(R.layout.item_post_list) {
    override fun convert(holder: BaseViewHolder, item: PostBean) {
        holder.setText(R.id.text_name, item.nickName)
              .setText(R.id.text_content, item.postContent)
        Glide.with(context).load(ServiceCreator.BASE_URL + item.userAvatar)
            .apply(RequestOptions.bitmapTransform(CircleCrop())).into(holder.getView(R.id.img_user))
    }
}